﻿<%@ Page Title="新闻主页" Language="C#" MasterPageFile="~/Areas/Website/Views/Shared/Master.Master"
    Inherits="System.Web.Mvc.ViewPage<PagedList<ENews>>" %>

<%@ Import Namespace="Webdiyer.WebControls.Mvc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <%if (Model.Count == 0)
      {%>
    <h2>
        没有数据！</h2>
    <%}
      else
      {%>
    <h2>
        新闻列表</h2>
    <table class="table">
        <tr>
            <th>
                编 号
            </th>
            <th>
                标 题
            </th>
            <th>
                类 别
            </th>
            <th>
                作 者
            </th>
            <th>
                时 间
            </th>
        </tr>
        <%
            int i = 0;
            foreach (ENews news in Model)
            {
                i++;
        %>
        <tr>
            <td>
                <%=i %>
            </td>
            <td>
                <%= Html.ActionLink(news.Title, "NewsInfo", "News", new { newsId=news.NewsId }, null) %>
            </td>
            <td>
                <%=news.ClassifyName%>
            </td>
            <td>
                <%=news.Author%>
            </td>
            <td>
                <%=news.WriteTime.ToString("yyyy-MM-dd HH:mm:ss") %>
            </td>
        </tr>
        <%
}
        %>
        <tr>
            <td colspan="2">
                <span>共<%=Model.TotalItemCount %>条记录， 页<%=Model.CurrentPageIndex %>/<%=Model.TotalPageCount %></span>
            </td>
            <td colspan="3" align="right">
                <%=Html.Pager(Model,new PagerOptions{ContainerTagName="span", PageIndexParameterName="NewsId",AlwaysShowFirstLastPageNumber = true,HorizontalAlign="right"}) %>
            </td>
        </tr>
    </table>
    <% } %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="server">
    <% = HtmlMetaHelper.HtmlTitle("新闻主页")%>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="cssLink" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="jsLink" runat="server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="cssContent" runat="server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="jsContent" runat="server">
</asp:Content>
